window.onload = function(){
    render()
}
// 全部题目 和 选项
var subject = JSON.parse(localStorage.getItem('data'))
var domHtml = localStorage.getItem('dom')
console.log(subject)

function render(){
    $('.inputFormTwo').html(domHtml)
    $('.details').show()
    $('.input').attr('disabled',true)
    $('textarea').attr('disabled',true)
    for(let i=0;i<subject.length;i++){
        if(subject[i].answerType == '1'){
            $("input[name='topic"+subject[i].topicID+"'][value='"+ subject[i].answer +"']").attr('checked',true)
        } else if(subject[i].answerType == '2'){
            let aa =  subject[i].answer.split(',')
            for(let j=0;j<aa.length;j++){
                $("input[name='topic"+subject[i].topicID+"'][value='"+ aa[j] +"']").attr('checked',true)
            }
        } else if(subject[i].answerType == '3'){
            $('#wenda'+subject[i].topicID).val(subject[i].answer)
        } else if(subject[i].answerType == '4'){
            let star = $('.star'+subject[i].topicID).children()
            let starNum = $('.star'+subject[i].topicID).attr('data-star')
            
            for(let k=0;k<subject[i].answer;k++){
                star[k].classList.add('xx-star')
                star[k].classList.remove('xx-star2')
            }
        }
        
    }
}